﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ElevatorSimCSharp
{
    class Building
    {
        byte highestFloor;
        byte lowestFloor;
        private Floor[] floors;
        private Elevator[] elevators;

        public Building(byte highestFloor, byte lowestFloor, byte numberOfElevators)
        {
            this.highestFloor = highestFloor;
            this.lowestFloor = lowestFloor;
            this.floors = new Floor[highestFloor - lowestFloor];
            for (int i = 0; i < highestFloor; i++ )
            {
                this.floors[i] = new Floor();
                this.floors[i].initializeFloor((short) i);
            }   
            this.elevators = new Elevator[numberOfElevators];
            for (int i = 0; i < numberOfElevators; i++)
            {
                this.elevators[i] = new Elevator();
                this.elevators[i].initializeElevator(lowestFloor, highestFloor, lowestFloor, 10);
            }
        }

        public byte getLowestFloor()
        {
            return lowestFloor;
        }

        public byte getHighestFloor()
        {
            return highestFloor;
        }

        public Floor[] getFloors()
        {
            return floors;
        }

        public Elevator[] getElevators()
        {
            return elevators;
        }

        public List<Person> getCurrentFloorPeopleList(short currentFloor)
        {
            return floors[currentFloor].getPersonsList();
        }

        public void putPersonOnFloor(Person person, short floorNumber)
        {
            floors[floorNumber].addPerson(person);
        }
    }
}
